<?php
if(!empty($_POST) && isset($_POST['Save']))
{
	$date = @date("Y.m.d H.i.s");
	$ToID = GetID($_POST['adress']);
	$con = Connect();
	mysql_query("INSERT INTO message (ID, ToID, TimeStamp, Title, Text, Checked) VALUES ('".$_SESSION['ID']."', '$ToID', '$date', '".$_POST['Title']."', '".$_POST['Text']."', '0');");
	Close($con);
}
$entry = $_GET['value'];
$con = Connect();
$result = mysql_fetch_assoc(mysql_query("SELECT * FROM message WHERE ToID='".$_SESSION['ID']."' AND TimeStamp='$entry'"));
Close($con);
?>
<form method="POST">
	<table class="Message">
		<tr>
			<th>Empf&auml;nger: </th><th><input type="text" name="adress" value="<?php echo GetName($result['ID']); ?>"></th>
			<th>Titel: </th><th><input type="text" name="Title" value="Re: <?php echo $result['Title']; ?>"></th>
		</tr>
		<tr>
			<th>Text: </th><th><input type="text" name="Text" value="<?php echo $result['Text']; ?>"></th>
		</tr>
		<tr>
			<th style="visibility:hidden"><input type="hidden"></th><th><input type="submit" name="Save" value="Senden"></th>
		</tr>
	</table>
</form>